import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/home'// 重定向:重新指向其它path,会改变网址
  },
  {
    path: '/home',
    name: 'Home',
    component:Home,
    redirect: '/Home/HomePage',
    children: [
      {
        path: 'add',
        name: 'Add',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/Add.vue'),
      },
      {
        path: 'homePage',
        name: 'HomePage',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/HomePage.vue'),
      },
      {
        path: 'my',
        name: 'My',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/My.vue'),
      },
      {
        path: 'strategy',
        name: 'Strategy',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/Strategy.vue'),
      },
      {
        path: 'attention',
        name: 'Attention',
        component: () => import(/* webpackChunkName: "about" */ '../views/Home/Attention.vue'),
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
